        <?
        require_once('header.php'); // uri  
        ?>
        <!--[if lt IE 7]>
            <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
        <![endif]-->
       	<link rel="stylesheet" href="css/mainpage.css">
        <link rel="stylesheet" href="css/showbook.css">
        <script>
        var arraybook=new Array();
        </script>
        <script type="text/javascript" src="js/main.js"></script>
       	<div class="wrpOuter">
            <div class="wrpPage">
                
        <?
        require_once('subheader.php'); // uri  
        ?>      
                <div class="wrpOuterBody">
                    <div class="wrpBody clear">
                        <?
                        require_once('menu.php'); // uri  
                        ?>
                        <!-- contentlist -->
                       
                        <div class="wrpOuterContentList">
                            <div class="wrpInnerContentlist">
                                <!-- Banner -->
                                <div class="wrapAddBanner">
                                <!--
                                    <div class="addBanner">
                                        <div class="wrapBnDef">
                                            <div class="wrapTumbnlBnDef">
                                                <?if(count($this->data['userbanner']))
                                                {
                                                foreach($this->data['userbanner'] as $valuebanner)
                                                {
                                                ?>
                                                <div class="upBnImg">
                                                    <a target="_blank" href="<?=$valuebanner['link']?>"><img class="upBnImgA" src="<?if($valuebanner['photo']){echo imginfo."/".$this->data['userpremium']['shelfid'].'/banner/'.$valuebanner['photo'];}?>" alt="upimage"></a>
                                                </div>
                                                
                                                <?
                                                }
                                                }?>
                                                

                                            </div>
                                        </div>
                                    </div>
                                    <div class="dotPageB">
                                    <?
                                               if(count($this->data['userbanner']))
                                                {
                                                $k=1;
                                                foreach($this->data['userbanner'] as $valuebanner)
                                                {
                                                $check="";
                                                if($k==1)
                                                {
                                                $check="dotInB";
                                                
                                                }
                                                ?>
                                               <div class="dotOutB dotBP<?=$k?> <?=$check?>"></div>
                                            <?
                                                 $k++;
                                            
                                                }
                                                
                                                }?>

                                    </div>
                                -->    
                                    
                                </div>
                                <!-- End Banner -->
                                <div class="navTopBar">
                                    <h2 class="tabShowTopBar"><? if($namecat){ echo $namecat;  }else{?>All Tags<?}?></h2>
                                    <div class="wrpSort">
                                        <div class="btnSort"><i></i><em>จัดเรียงโดย <?
                                        
                                        
                                         switch (intval($_GET['orderby'])) {
                                         case 1:
                                         $setorder="วันที่ล่าสุด";
                                            break;
                                        case 2:
                                            $setorder="วันที่เก่าสุด";
                                            break;
                                        case 3:
                                            $setorder="ตามชื่อการประชุม";
                                            break;
                                        case 5:
                                            $setorder="ตามชื่อไฟล์เอกสาร";
                                            break;
            }
                                        
                                        echo $setorder;
                                        
                                        ?></em>
                                            <div class="wrpUllistSort">
                                                <ul class="ullisSort">
                                                    <li class="liSort" onclick="location.href='<?=baseinfo?>/?<?=$this->data['query1']?>&orderby=1'"><div class="listSort">วันที่ล่าสุด</div></li>
                                                    <li class="liSort" onclick="location.href='<?=baseinfo?>/?<?=$this->data['query1']?>&orderby=2'"><div class="listSort">วันที่เก่าสุด</div></li>
                                                    <li class="liSort" onclick="location.href='<?=baseinfo?>/?<?=$this->data['query1']?>&orderby=3'"><div class="listSort">ตามชื่อการประชุม</div></li>
                                                    <li class="liSort" onclick="location.href='<?=baseinfo?>/?<?=$this->data['query1']?>&orderby=5'"><div class="listSort">ตามชื่อไฟล์เอกสาร</div></li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="wrpOuterListTile">
                                  <div class="wrpInnerListTile">
                                   <?
                                      if(count($this->data['arraybook']))
                                      {
                                      $k=0;
                                      $row=0;
                                      $pageall=12;

                                      foreach($this->data['arraybook'] as $valuebook){?>
                                       <?if(($k%$pageall)==0){
                                             $show="display:none";
                                           if($row==0)
                                           {
                                             $show="display:block";
                                           
                                           }
                                       ?>
                                        
                                       <div class="pagedataall" id="pagerow-<?=$row?>" style="<?=$show?>" >
                                       <?
                                        $row++;
                                       }?>
                                        <div class="tile">
                                            <div class="innerTile">
                                                <div class="wrpEditViewHover">
                                                   <div class="wrpInnerEditViewHover">
                                                           <?if($valuebook['oauth']==$_COOKIE['oauth']||$this->data['userpremium']['admin']==1){?>
                                                           <button onclick="location.href='<?=baseinfo?>/addbook?bookid=<?=$valuebook['bookid']?>&shelfid=<?=$this->data['userpremium']['shelfid']?>'"  class="btnEditBook">แก้ไข</button>
                                                           <?}?>
                                                            <button type="button" onclick="showdatapopup(<?=$valuebook['bookid']?>)" class="btnViewBook">รายละเอียด</button>
                                                   </div>
                                                </div>
                                                <div class="wrpFtShow">
                                                <!--    <div class="lfFt priceFt"><?=$valuebook['price']?><em>$</em></div>-->
                                                         <?if($valuebook['createdate']){
                                                         
                                                             $string=explode(" ",$valuebook['createdate']);
                                                             $string=$string[0];
                                                             if($string==date("Y-m-d"))
                                                             {
                                                             ?>
                                                             <div class="rfFt newFt">New</div>
                                                             <?
                                                             
                                                             }
                                                         }?>
                                                    <!--<div class="rfFt newFt">New</div>-->
                                                </div>  
                                                <div class="wrpImgTileOuter">                             
                                                    <a href="javascript:void(0)"  class="wrpImgTile">
                                                        <div class="imgTile clickImgTile">
                                                            <img class="imgTileCell" src="<?
                                                            
                                                            if($valuebook['photo'])
                                                            {
                                                            echo imginfo.'/'.$valuebook['shelfid'].'/'.$valuebook['bookid'].'/'.$valuebook['photo'];
                                                            }else
                                                            {
                                                            echo baseinfo.'/img/topic.png';
                                                            
                                                            }
                                                            
                                                            ?>" alt="ImageTile">
                                                             <div class="bgshadow"></div>
                                                        </div>
                                                        <p class="pTile"><?=$valuebook['title']?> </p>
                                                    </a>
                                                </div>
                                                <div class="wrpUserTile">
                                                    <img class="imguserTileCell" src="<? if($valuebook['avatarphoto']&&is_file(imgpath.'/user/'.$valuebook['userid'].'/'.$valuebook['avatarphoto'])){ echo imginfo.'/user/'.$valuebook['userid'].'/'.$valuebook['avatarphoto'];}else{?>img/mocimagetile.png<?}?>" alt="ImageUser">
                                                    <p class="userNameTile"><?=$valuebook['username']?><?if($valuebook['createby']!=$valuebook['updateby']){ echo " (Edit By SuperAdmin)";}?></p>
                                                </div>
                                            </div>
                                        </div>
                                      
                                      <?
                                      $k++;
                                      if(($k%$pageall)==0){?>
                                      </div>
                                      
                                      <?
                                        //$row++;
                                       }?>
                                    
                                    <?
                                      }
                                      if(($k%$pageall)!=0){
                                      ?>
                                      </div>
                                      <?
                                      }
                                    }
                                    ?>
                                    </div>
                                  </div>
                                  
                                <div class="pagerowall">Page <?if(count($row)){ 
                                for($i=0;$i<$row;$i++){
                                     
                                    $classi="";
                                    if($i==0)
                                    {
                                    
                                   $classi="active"; 
                                    }
                                  ?>
                                <i class="pagenumber <?=$classi?>" id="pagenum-<?=$i?>" onclick="changepage(<?=$i?>)"><?=($i+1)?></i> 
                                <?if(($i+1)!=$row){?>|   <?} 
                                } 
                                
                                }?> 
                                
                                </div>
                                     
                            </div>
                             
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script>
        
        var k=0;
         <?if(count($this->data['arraybook']))
                                      {

                 foreach($this->data['arraybook'] as $valuebook){?>
                                   
                                   
                                   arraybook[k]='<?=$valuebook['bookid']?>';
                                   k++;
                                   
                                   <?
                                   
                                   
                                   
                                   
                                   }
                                   
                                   
                                      }?>
        
        </script>
        
         <!-- show Book -->
        <div class="wrpShowlanding">
            <div class="overlayWhitBook"></div>
             <div class="popBook">
                <div class="wrpPopBookInner">
                    <div class="topBar">
                        <div class="wrapLeftIcon wrapIcon">
                            <i class="leftIcon iconTop" id="lefticon" ></i>
                        </div>
                        <div class="wrapRightIcon wrapIcon">
                            <i class="rightIcon iconTop" id="righticon"></i>
                        </div>
                        <div class="wrapCloseIcon wrapIcon">    
                            <i class="closeIcon iconTop"></i>
                        </div>
                    </div>
                    <div class="wrapShowBook">
                        <div class="wrapAuthor">
                            <p class="authorName">By 
                                <span id="text-username">Myriam Joire</span>
                            </p>
                            <div class="wrapUpdateDate">
<!--                                <i class="calendarIcon" id="edtibookset" ></i>-->
                                <i class="calendarIcon"></i>
                                <p class="updateDate" id="text-updatedate">April 8, 2013</p>
                            </div>
                        </div>
                        <div class="showBook">
                        <table class="typeData">
                         <tr>
                         <td>หัวข้อการประชุม</td>
                         <td id="text-title"></td>
                         </tr>
                         
                         <tr>
                         <td>ชื่อการประชุม</td>
                         <td id="text-description"></td>
                         </tr>
                         
                         <tr>
                         <td>วันที่</td>
                         <td id="text-date"></td>
                         </tr>
                         
                         <tr>
                         <td>เวลาการประชุม</td>
                         <td id="text-time"></td>
                         </tr>
                         
                         
                         <tr>
                         <td>สถานที่</td>
                         <td id="text-place"></td>
                         </tr>
                         
                           
                            
                            
                            
                        </table>    
                            
                            

                                <div id="booktable">
                                
                                </div>



                            
                           <!-- <div class="qrcode" style="text-align: center;"><a id="linkQRCode" target="_blank"  href=""><img id="editQRCode" src=""></a></div>-->
                            
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        
        
        <?
        require_once('footer.php'); // uri  
        ?>